import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import typescript from '@rollup/plugin-typescript';
import { terser } from 'rollup-plugin-terser';

export default {
    input: 'src/index.ts',
    output: [
        {
        file: 'dist/index.cjs.js',
        format: 'cjs',
        sourcemap: true,
        },
        {
        file: 'dist/index.esm.js',
        format: 'esm',
        sourcemap: true,
        },
    ],
    plugins: [
        resolve(),
        commonjs(),
        typescript({ tsconfig: './tsconfig.json' }),
        terser(), // 压缩代码
    ],
    external: ['axios'], // 指定外部依赖，避免打包到输出文件中
};